import React from "react"
import "../../styles/sty/nav_y.css"
import { getList }  from "../../api/index_y"
// import {NavLink } from "react-router-dom"


    class Nav_y extends React.Component{

        constructor(params) {
            super()
            this.state={
                  list:[]
            }
        }

        componentDidMount(){
        getList().then(res=>{
            console.log(res)
            this.setState({
                list:res.data
            })
        })
    }


    add(){
<<<<<<< HEAD
        this.props.history.push("/shop")
=======
        this.props.history.push("/App")
>>>>>>> 90970c75563bd55771150ee58505cae3aacce616
    }

        render() {
                   let { list }=this.state
            return (
                <div  id="bx">
                   
                    <ul id="ul2">
                     {list.map(({ title,image_url,description })=>{
                            return (
                             <li onClick={this.add.bind(this)}>    
                                    <img src={"https://fuss10.elemecdn.com"+image_url}/>
                                    <i>{title}</i>
                                    
                                    <p>{description}</p> 
                                   
                                </li> 
                               
                            )
                        })}
                    </ul>
                </div>

            )

        }
        
    }

 export default Nav_y